<div>
    <fieldset id="EditUserField" style="padding-top: 1em;">
        <legend><?php echo "Пользователь ".@$this->data['login']; ?></legend>

        <input type="hidden" id="user_id" value="<?php echo $this->data['user_id']; ?>"/>

        <table>

            <tr><td></td><td class="ErrorMessage" data-field="log"></td></tr>

            <tr>
                <td><label for="type">Тип:</label></td>
                <td><?php echo $this->UserTypes("type_id", false)
                        ->SetAttribute("class", "Text")
                        ->ToHtml(); ?></td>
            </tr>



            <tr style="padding-top: 2em;">
                <td class="AlignRight"><label for="login">Логин:</label></td>
                <td><input class="Text" type="text" id="login"
                    value="<?php echo $this->data['login']; ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="login"></td></tr>

            <tr>
                <td class="AlignRight"><label for="pass">Пароль:</label></td>
                <td><input class="Text" type="text" id="pass"
                    value="<?php echo $this->data['pass']; ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="pass"></td></tr>

            <tr>
                <td class="AlignRight"><label for="fullname">ФИО:</label></td>
                <td><input class="Text" type="text" id="fullname"
                    value="<?php echo $this->data['fullname']; ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="fullname"></td></tr>

            <tr>
                <td><label for="reg_date">Дата регистрации:</label></td>
                <td><input class="Text" type="text" id="reg_date"
                    value="<?php echo $this->data['reg_date']; ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="reg_date"></td></tr>

            <tr>
                <td><label for="reg_comp">Дата окончания:</label></td>
                <td><input class="Text" type="text" id="reg_comp"
                    value="<?php echo $this->data['reg_comp']; ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="reg_comp"></td></tr>

        </table>
    </fieldset>

    <div class="ControlPanel">
        <button id="EditUserBtn">Сохранить</button>
        <button id="DelUserBtn">Удалить</button>
        <button id="CancelEditBtn">Отмена</button>
    </div>


    <script type="text/javascript">
        jsun.run(function() {

        jsun("#EditUserBtn").jsun.event({onclick: AltUser });
        jsun("#DelUserBtn").jsun.event({onclick: DelUser });
        jsun("#CancelEditBtn").jsun.event({onclick: CancelEdit });

        function AltUser() {
            var param = "u=Admin/AltUser"
                + jsun.page.get_data({ elem: [
                    "user_id", "type_id",
                    "fullname", "login", "pass",
                    "reg_date", "reg_comp"
                ] });

            jsun.json.load(function(p) {
                if (p.STAT != 'ERR') {
                    FindUser();
                    jsun.dialog.active.close();
                } else {
                    jsun.show_err(p);
                }
            }, param);
        }

        function DelUser() {
            var param = "u=Admin/DelUser&user_id=" + jsun("#user_id").value;

            jsun.json.load(function(p) {
                if (p.STAT != 'ERR') {
                    FindUser();
                    jsun.dialog.active.close();
                } else {
                    jsun.show_err(p);
                }
            }, param);
        }

        function FindUser() {
            var pref = "UserList";
            jsun.swap[pref].Req = param + jsun.page.get_data();
            jsun.swap[pref].Start();
        }

        function CancelEdit() {
            return jsun.dialog.active.close();
        }

        });
    </script>
</div>